home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1999 November / SOTMC_Nov1999-Ultimate.iso / mac / REALbasic ƒ / Examples / Techniques / Examples by Thomas Tempelmann / FAQs from RB-NUG mailing list / Exception Handling < prev    next >
MacBinary  |  1999-07-06  |  11.5 KB  |  [clpt/drag]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
1% dexvert MacBinary (archive/macBinary) fallback Supported
100% file MacBinary II, inited, Sun Mar 14 06:52:19 1999, modified Tue Jul 6 15:26:22 1999, creator 'drag', type 'clpt' "Exception Handling", at 0x80 11552 bytes resource Apple HFS/HFS+ resource fork, map offset 0x2cb2, map length 0x6e, data length 0x2bb2, nextResourceMap 0x975f700, fileRef 0x336a, list offset 0x1c, name offset 0x6e, 4 types, 0x54455854 'TEXT' * 1 resource offset 0x22 default (weak)
99% file Adobe Photoshop Color swatch, version 0, 256 colors; 1st RGB space (0), w 0x2cb2, x 0, y 0x2bb2, z 0 ; 2nd space (110), w 0, x 0, y 0, z 0 default (weak)
98% file data default
74% TrID Mac Text clippings (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% dearkID deark: macbinary default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[clpt]
macFileCreator[drag]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 12 45 78 63 65 70 74 | 69 6f 6e 20 48 61 6e 64 |..Except|ion Hand|
|00000010| 6c 69 6e 67 00 00 00 00 | 00 00 00 00 00 00 00 00 |ling....|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 63 6c 70 74 64 72 61 | 67 01 00 00 00 00 00 00 |.clptdra|g.......|
|00000050| 00 00 00 00 00 00 00 00 | 00 2d 20 b3 11 53 73 b3 |........|.- ..Ss.|
|00000060| a8 08 de 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 c5 7d 00 00 |........|.....}..|
|00000080| 00 00 01 00 00 00 2c b2 | 00 00 2b b2 00 00 00 6e |......,.|..+....n|
|00000090| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000b0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000c0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000d0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000000f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000100| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000180| 00 00 2b 38 4a 75 73 74 | 20 74 68 69 73 20 6d 6f |..+8Just| this mo|
|00000190| 72 6e 69 6e 67 20 28 61 | 63 74 75 61 6c 6c 79 2c |rning (a|ctually,|
|000001a0| 20 73 74 69 6c 6c 20 6c | 61 79 69 6e 67 20 69 6e | still l|aying in|
|000001b0| 20 62 65 64 20 69 6e 20 | 74 68 61 74 20 6b 69 6e | bed in |that kin|
|000001c0| 64 0d 6f 66 20 6e 6f 74 | 2d 64 72 65 61 6d 69 6e |d.of not|-dreamin|
|000001d0| 67 2d 61 6e 79 6d 6f 72 | 65 20 6d 6f 64 65 29 2c |g-anymor|e mode),|
|000001e0| 20 69 74 20 61 70 70 65 | 61 72 65 64 20 74 6f 20 | it appe|ared to |
|000001f0| 6d 65 20 68 6f 77 20 65 | 61 73 79 20 61 6e 64 0d |me how e|asy and.|
|00000200| 6e 69 63 65 6c 79 20 79 | 6f 75 20 63 61 6e 20 64 |nicely y|ou can d|
|00000210| 6f 20 65 78 63 65 70 74 | 69 6f 6e 20 68 61 6e 64 |o except|ion hand|
|00000220| 6c 69 6e 67 20 77 69 74 | 68 20 52 42 20 28 49 20 |ling wit|h RB (I |
|00000230| 6b 6e 65 77 20 61 6c 72 | 65 61 64 79 0d 69 74 73 |knew alr|eady.its|
|00000240| 20 62 61 73 69 63 73 2c | 20 62 75 74 20 74 68 65 | basics,| but the|
|00000250| 20 72 65 61 6c 69 7a 61 | 74 69 6f 6e 20 74 68 61 | realiza|tion tha|
|00000260| 74 20 61 6e 20 45 78 63 | 65 70 74 69 6f 6e 20 63 |t an Exc|eption c|
|00000270| 61 6e 20 62 65 0d 65 78 | 74 65 6e 64 65 64 20 62 |an be.ex|tended b|
|00000280| 65 63 61 75 73 65 20 6f | 66 20 69 74 73 20 6e 61 |ecause o|f its na|
|00000290| 74 75 72 65 20 6f 66 20 | 62 65 69 6e 67 20 61 20 |ture of |being a |
|000002a0| 63 6c 61 73 73 2c 20 73 | 74 72 75 63 6b 0d 6d 65 |class, s|truck.me|
|000002b0| 20 6c 69 6b 65 20 6c 69 | 67 68 74 6e 69 6e 67 20 | like li|ghtning |
|000002c0| 61 6e 64 20 6d 61 64 65 | 20 6d 65 20 6a 75 6d 70 |and made| me jump|
|000002d0| 20 6f 75 74 20 6f 66 20 | 74 68 65 20 62 65 64 20 | out of |the bed |
|000002e0| 72 69 67 68 74 0d 61 77 | 61 79 20 61 6e 64 20 74 |right.aw|ay and t|
|000002f0| 75 72 6e 69 6e 67 20 6d | 65 20 4d 61 63 20 6f 6e |urning m|e Mac on|
|00000300| 20 74 6f 20 77 72 69 74 | 65 20 74 68 69 73 20 64 | to writ|e this d|
|00000310| 6f 77 6e 20 66 6f 72 20 | 61 6c 6c 20 6f 66 20 79 |own for |all of y|
|00000320| 6f 75 29 3a 0d 0d 45 78 | 63 65 70 74 69 6f 6e 20 |ou):..Ex|ception |
|00000330| 28 6f 72 20 65 72 72 6f | 72 29 20 68 61 6e 64 6c |(or erro|r) handl|
|00000340| 69 6e 67 20 69 73 20 68 | 61 72 64 6c 79 20 64 6f |ing is h|ardly do|
|00000350| 63 75 6d 65 6e 74 65 64 | 20 69 6e 20 52 42 3b 0d |cumented| in RB;.|
|00000360| 74 68 65 79 20 6f 6e 6c | 79 20 67 69 76 65 20 79 |they onl|y give y|
|00000370| 6f 75 20 73 6f 6d 65 20 | 73 68 6f 72 74 20 65 78 |ou some |short ex|
|00000380| 70 6c 61 6e 61 74 69 6f | 6e 20 6f 66 20 69 74 73 |planatio|n of its|
|00000390| 20 73 79 6e 74 61 78 2c | 0d 62 75 74 20 6e 6f 20 | syntax,|.but no |
|000003a0| 72 65 61 6c 2d 77 6f 72 | 6c 64 20 65 78 61 6d 70 |real-wor|ld examp|
|000003b0| 6c 65 73 20 6f 72 20 6f | 74 68 65 72 20 69 64 65 |les or o|ther ide|
|000003c0| 61 73 20 66 6f 72 20 77 | 68 61 74 20 69 74 20 69 |as for w|hat it i|
|000003d0| 73 0d 67 6f 6f 64 20 66 | 6f 72 2e 0d 0d 4f 4b 2c |s.good f|or...OK,|
|000003e0| 20 73 6f 20 6c 65 74 27 | 73 20 6d 61 6b 65 20 74 | so let'|s make t|
|000003f0| 68 69 73 20 6f 6e 65 20 | 61 20 6c 69 74 74 6c 65 |his one |a little|
|00000400| 20 74 75 74 6f 72 69 61 | 6c 20 66 6f 72 20 61 6c | tutoria|l for al|
|00000410| 6c 20 6f 66 0d 79 6f 75 | 20 52 42 20 75 73 65 72 |l of.you| RB user|
|00000420| 73 20 74 68 61 74 20 61 | 72 65 20 6b 69 6e 64 20 |s that a|re kind |
|00000430| 6f 66 20 6e 65 77 20 74 | 6f 20 4f 62 6a 65 63 74 |of new t|o Object|
|00000440| 20 6f 72 69 65 6e 74 65 | 64 20 61 6e 64 0d 6f 74 | oriente|d and.ot|
|00000450| 68 65 72 20 6d 6f 64 65 | 72 6e 20 70 72 6f 67 72 |her mode|rn progr|
|00000460| 61 6d 6d 69 6e 67 20 74 | 65 63 68 6e 69 71 75 65 |amming t|echnique|
|00000470| 73 2e 0d 0d 42 54 57 2c | 20 68 65 72 65 27 73 20 |s...BTW,| here's |
|00000480| 6d 79 20 6c 69 74 74 6c | 65 20 63 6f 70 79 72 69 |my littl|e copyri|
|00000490| 67 68 74 20 6e 6f 74 69 | 63 65 3a 20 72 65 64 69 |ght noti|ce: redi|
|000004a0| 73 74 72 69 62 75 74 69 | 6f 6e 0d 6f 66 20 74 68 |stributi|on.of th|
|000004b0| 69 73 20 69 73 20 70 65 | 72 6d 69 74 74 65 64 20 |is is pe|rmitted |
|000004c0| 61 73 20 6c 6f 6e 67 20 | 61 73 20 69 74 20 69 73 |as long |as it is|
|000004d0| 20 64 6f 6e 65 20 66 6f | 72 20 66 72 65 65 2e 20 | done fo|r free. |
|000004e0| 49 0d 72 65 74 61 69 6e | 20 74 68 65 20 63 6f 70 |I.retain| the cop|
|000004f0| 79 72 69 67 68 74 2e 20 | 54 68 6f 6d 61 73 20 54 |yright. |Thomas T|
|00000500| 65 6d 70 65 6c 6d 61 6e | 6e 20 28 72 62 40 74 65 |empelman|n (rb@te|
|00000510| 6d 70 65 6c 2e 6f 72 67 | 29 2e 0d 0d 0d 57 68 61 |mpel.org|)....Wha|
|00000520| 74 27 73 20 74 68 65 20 | 70 75 72 70 6f 73 65 20 |t's the |purpose |
|00000530| 6f 66 20 45 78 63 65 70 | 74 69 6f 6e 20 48 61 6e |of Excep|tion Han|
|00000540| 64 6c 69 6e 67 3f 0d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |dling?.-|--------|
|00000550| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000560| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000570| 0d 0d 45 78 63 65 70 74 | 69 6f 6e 20 68 61 6e 64 |..Except|ion hand|
|00000580| 6c 69 6e 67 20 63 6f 6d | 65 73 20 69 6e 20 68 61 |ling com|es in ha|
|00000590| 6e 64 79 20 67 65 6e 65 | 72 61 6c 6c 79 20 61 6e |ndy gene|rally an|
|000005a0| 79 0d 74 69 6d 65 20 79 | 6f 75 20 77 61 6e 74 20 |y.time y|ou want |
|000005b0| 74 6f 20 61 62 6f 72 74 | 20 61 20 70 72 6f 63 65 |to abort| a proce|
|000005c0| 73 73 20 69 6e 20 61 20 | 70 72 6f 63 65 64 75 72 |ss in a |procedur|
|000005d0| 65 0d 28 73 75 62 72 6f | 75 74 69 6e 65 29 20 62 |e.(subro|utine) b|
|000005e0| 65 63 61 75 73 65 20 6f | 66 20 73 6f 6d 65 20 65 |ecause o|f some e|
|000005f0| 72 72 6f 72 20 63 6f 6e | 64 69 74 69 6f 6e 2e 0d |rror con|dition..|
|00000600| 0d 43 6f 6e 73 69 64 65 | 72 20 79 6f 75 20 77 72 |.Conside|r you wr|
|00000610| 69 74 65 20 61 20 70 72 | 6f 63 65 64 75 72 65 20 |ite a pr|ocedure |
|00000620| 74 68 61 74 20 61 64 64 | 73 20 61 20 6c 69 6e 65 |that add|s a line|
|00000630| 0d 6f 66 20 74 65 78 74 | 20 70 6c 75 73 20 61 20 |.of text| plus a |
|00000640| 6e 75 6d 62 65 72 2c 20 | 74 68 61 74 20 61 6c 77 |number, |that alw|
|00000650| 61 79 73 20 69 73 20 73 | 75 70 70 6f 73 65 64 0d |ays is s|upposed.|
|00000660| 74 6f 20 62 65 20 70 6f | 73 69 74 69 76 65 2c 20 |to be po|sitive, |
|00000670| 74 6f 20 61 20 66 69 6c | 65 2e 20 54 68 65 20 62 |to a fil|e. The b|
|00000680| 61 73 69 63 20 63 6f 64 | 65 20 77 6f 75 6c 64 0d |asic cod|e would.|
|00000690| 6c 6f 6f 6b 20 6c 69 6b | 65 20 74 68 69 73 3a 0d |look lik|e this:.|
|000006a0| 0d 20 20 53 75 62 20 41 | 64 64 4c 69 6e 65 54 6f |. Sub A|ddLineTo|
|000006b0| 54 65 78 74 66 69 6c 65 | 28 74 65 78 74 20 61 73 |Textfile|(text as|
|000006c0| 20 53 74 72 69 6e 67 2c | 20 70 6f 73 4e 75 6d 20 | String,| posNum |
|000006d0| 61 73 20 49 6e 74 65 67 | 65 72 2c 20 66 69 6c 65 |as Integ|er, file|
|000006e0| 52 65 66 20 61 73 20 46 | 6f 6c 64 65 72 49 74 65 |Ref as F|olderIte|
|000006f0| 6d 29 0d 20 20 20 20 44 | 69 6d 20 66 69 6c 65 53 |m). D|im fileS|
|00000700| 74 72 65 61 6d 20 41 73 | 20 54 65 78 74 4f 75 74 |tream As| TextOut|
|00000710| 70 75 74 53 74 72 65 61 | 6d 0d 20 20 20 20 0d 20 |putStrea|m. . |
|00000720| 20 20 20 66 69 6c 65 53 | 74 72 65 61 6d 20 3d 20 | fileS|tream = |
|00000730| 66 69 6c 65 52 65 66 2e | 41 70 70 65 6e 64 54 6f |fileRef.|AppendTo|
|00000740| 54 65 78 74 46 69 6c 65 | 0d 20 20 20 20 66 69 6c |TextFile|. fil|
|00000750| 65 53 74 72 65 61 6d 2e | 57 72 69 74 65 4c 69 6e |eStream.|WriteLin|
|00000760| 65 20 28 74 65 78 74 20 | 2b 20 22 20 28 74 68 65 |e (text |+ " (the|
|00000770| 20 6e 75 6d 62 65 72 20 | 69 73 3a 20 22 20 2b 20 | number |is: " + |
|00000780| 53 74 72 28 70 6f 73 4e | 75 6d 29 20 2b 20 22 29 |Str(posN|um) + ")|
|00000790| 22 29 0d 20 20 20 20 66 | 69 6c 65 53 74 72 65 61 |"). f|ileStrea|
|000007a0| 6d 2e 43 6c 6f 73 65 0d | 20 20 45 6e 64 20 53 75 |m.Close.| End Su|
|000007b0| 62 0d 0d 54 68 65 20 63 | 6f 64 65 20 75 73 69 6e |b..The c|ode usin|
|000007c0| 67 20 74 68 61 74 20 73 | 75 62 72 6f 75 74 69 6e |g that s|ubroutin|
|000007d0| 65 20 63 6f 75 6c 64 20 | 62 65 20 6c 69 6b 65 20 |e could |be like |
|000007e0| 74 68 69 73 3a 0d 0d 20 | 20 53 75 62 20 57 72 69 |this:.. | Sub Wri|
|000007f0| 74 65 53 6f 6d 65 4c 69 | 6e 65 73 54 6f 41 46 69 |teSomeLi|nesToAFi|
|00000800| 6c 65 28 29 0d 20 20 20 | 20 44 69 6d 20 74 6d 70 |le(). | Dim tmp|
|00000810| 46 69 6c 65 52 65 66 20 | 61 73 20 46 6f 6c 64 65 |FileRef |as Folde|
|00000820| 72 49 74 65 6d 0d 20 20 | 20 20 74 6d 70 46 69 6c |rItem. | tmpFil|
|00000830| 65 52 65 66 20 3d 20 47 | 65 74 46 6f 6c 64 65 72 |eRef = G|etFolder|
|00000840| 49 74 65 6d 28 22 74 6d | 70 46 69 6c 65 2e 74 78 |Item("tm|pFile.tx|
|00000850| 74 22 29 0d 20 20 20 20 | 0d 20 20 20 20 69 66 20 |t"). |. if |
|00000860| 74 6d 70 46 69 6c 65 52 | 65 66 2e 45 78 69 73 74 |tmpFileR|ef.Exist|
|00000870| 73 20 74 68 65 6e 0d 20 | 20 20 20 20 20 74 6d 70 |s then. | tmp|
|00000880| 46 69 6c 65 52 65 66 2e | 44 65 6c 65 74 65 28 29 |FileRef.|Delete()|
|00000890| 0d 20 20 20 20 65 6e 64 | 0d 20 20 20 20 0d 20 20 |. end|. . |
|000008a0| 20 20 41 64 64 4c 69 6e | 65 54 6f 54 65 78 74 66 | AddLin|eToTextf|
|000008b0| 69 6c 65 28 22 32 2a 32 | 22 2c 20 32 2a 32 2c 20 |ile("2*2|", 2*2, |
|000008c0| 74 6d 70 46 69 6c 65 52 | 65 66 29 0d 20 20 20 20 |tmpFileR|ef). |
|000008d0| 41 64 64 4c 69 6e 65 54 | 6f 54 65 78 74 66 69 6c |AddLineT|oTextfil|
|000008e0| 65 28 22 35 2a 35 22 2c | 20 35 2a 35 2c 20 74 6d |e("5*5",| 5*5, tm|
|000008f0| 70 46 69 6c 65 52 65 66 | 29 0d 20 20 45 6e 64 20 |pFileRef|). End |
|00000900| 53 75 62 0d 0d 54 68 65 | 20 70 72 6f 62 6c 65 6d |Sub..The| problem|
|00000910| 20 69 73 20 74 68 61 74 | 20 74 68 65 20 41 64 64 | is that| the Add|
|00000920| 4c 69 6e 65 54 6f 54 65 | 78 74 66 69 6c 65 20 72 |LineToTe|xtfile r|
|00000930| 6f 75 74 69 6e 65 20 63 | 61 6e 0d 6e 6f 74 20 61 |outine c|an.not a|
|00000940| 6c 77 61 79 73 20 62 65 | 20 73 75 72 65 20 74 68 |lways be| sure th|
|00000950| 61 74 20 69 74 73 20 63 | 61 6c 6c 65 72 20 68 61 |at its c|aller ha|
|00000960| 73 20 73 65 74 20 75 70 | 20 65 76 65 72 79 74 68 |s set up| everyth|
|00000970| 69 6e 67 0d 63 6f 72 72 | 65 63 74 6c 79 3a 0d 0d |ing.corr|ectly:..|
|00000980| 54 68 65 72 65 27 73 20 | 73 65 76 65 72 61 6c 20 |There's |several |
|00000990| 63 6f 6e 64 69 74 69 6f | 6e 73 20 74 68 61 74 20 |conditio|ns that |
|000009a0| 74 68 65 20 63 61 6c 6c | 65 72 20 6d 75 73 74 20 |the call|er must |
|000009b0| 6d 65 65 74 3a 0d 2a 20 | 54 68 65 20 66 69 6c 65 |meet:.* |The file|
|000009c0| 52 65 66 20 6d 75 73 74 | 20 69 64 65 6e 74 69 66 |Ref must| identif|
|000009d0| 79 20 61 20 66 69 6c 65 | 20 28 61 6e 64 20 6e 6f |y a file| (and no|
|000009e0| 74 20 61 20 66 6f 6c 64 | 65 72 0d 20 20 6f 72 20 |t a fold|er. or |
|000009f0| 73 6f 6d 65 20 6f 74 68 | 65 72 20 69 6e 76 61 6c |some oth|er inval|
|00000a00| 69 64 20 6f 62 6a 65 63 | 74 29 2c 0d 2a 20 74 68 |id objec|t),.* th|
|00000a10| 65 20 66 69 6c 65 20 6d | 75 73 74 20 62 65 20 77 |e file m|ust be w|
|00000a20| 72 69 74 61 62 6c 65 20 | 28 6e 6f 74 20 6c 6f 63 |ritable |(not loc|
|00000a30| 6b 65 64 29 20 61 6e 64 | 0d 2a 20 74 68 65 20 6e |ked) and|.* the n|
|00000a40| 75 6d 62 65 72 20 6d 75 | 73 74 20 62 65 20 70 6f |umber mu|st be po|
|00000a50| 73 69 74 69 76 65 2e 0d | 0d 41 73 20 6c 6f 6e 67 |sitive..|.As long|
|00000a60| 20 61 73 20 79 6f 75 20 | 6b 6e 6f 77 20 74 68 65 | as you |know the|
|00000a70| 73 65 20 63 6f 6e 64 69 | 74 69 6f 6e 73 2c 20 79 |se condi|tions, y|
|00000a80| 6f 75 20 63 61 6e 0d 6d | 61 6b 65 20 73 75 72 65 |ou can.m|ake sure|
|00000a90| 20 74 68 61 74 20 79 6f | 75 20 6d 65 65 74 20 74 | that yo|u meet t|
|00000aa0| 68 65 6d 20 62 65 66 6f | 72 65 20 79 6f 75 20 63 |hem befo|re you c|
|00000ab0| 61 6c 6c 20 74 68 65 0d | 73 75 62 72 6f 75 74 69 |all the.|subrouti|
|00000ac0| 6e 65 2e 0d 0d 46 6f 72 | 20 69 6e 73 74 61 6e 63 |ne...For| instanc|
|00000ad0| 65 2c 20 69 66 20 79 6f | 75 20 6c 61 74 65 72 20 |e, if yo|u later |
|00000ae0| 77 61 6e 74 20 74 6f 20 | 72 65 2d 75 73 65 20 74 |want to |re-use t|
|00000af0| 68 65 0d 41 64 64 4c 69 | 6e 65 54 6f 54 65 78 74 |he.AddLi|neToText|
|00000b00| 66 69 6c 65 20 72 6f 75 | 74 69 6e 65 20 69 6e 20 |file rou|tine in |
|00000b10| 6f 74 68 65 72 20 70 72 | 6f 6a 65 63 74 73 2c 20 |other pr|ojects, |
|00000b20| 6f 72 20 65 76 65 6e 0d | 70 75 62 6c 69 73 68 20 |or even.|publish |
|00000b30| 69 74 20 74 6f 20 74 68 | 65 20 70 75 62 6c 69 63 |it to th|e public|
|00000b40| 2c 20 79 6f 75 20 77 61 | 6e 74 20 74 6f 20 6d 61 |, you wa|nt to ma|
|00000b50| 6b 65 20 73 75 72 65 20 | 69 6e 0d 61 64 76 61 6e |ke sure |in.advan|
|00000b60| 63 65 20 74 68 61 74 20 | 79 6f 75 72 20 73 75 62 |ce that |your sub|
|00000b70| 72 6f 75 74 69 6e 65 20 | 69 73 20 63 61 6c 6c 65 |routine |is calle|
|00000b80| 64 20 70 72 6f 70 65 72 | 6c 79 2e 0d 0d 48 6f 77 |d proper|ly...How|
|00000b90| 20 63 61 6e 20 79 6f 75 | 20 6d 61 6b 65 20 73 75 | can you| make su|
|00000ba0| 72 65 20 74 68 61 74 20 | 74 68 65 73 65 20 63 6f |re that |these co|
|00000bb0| 6e 64 69 74 69 6f 6e 73 | 20 61 72 65 0d 6d 65 74 |nditions| are.met|
|00000bc0| 3f 0d 2a 20 45 69 74 68 | 65 72 20 79 6f 75 20 64 |?.* Eith|er you d|
|00000bd0| 6f 63 75 6d 65 6e 74 20 | 74 68 65 20 63 6f 6e 64 |ocument |the cond|
|00000be0| 69 74 69 6f 6e 73 20 61 | 6e 64 20 68 6f 70 65 20 |itions a|nd hope |
|00000bf0| 74 68 61 74 0d 20 20 74 | 68 65 20 70 72 6f 67 72 |that. t|he progr|
|00000c00| 61 6d 6d 65 72 20 75 73 | 69 6e 67 20 74 68 69 73 |ammer us|ing this|
|00000c10| 20 73 75 62 72 6f 75 74 | 69 6e 65 20 77 69 6c 6c | subrout|ine will|
|00000c20| 20 72 65 61 64 20 61 6e | 64 0d 20 20 66 6f 6c 6c | read an|d. foll|
|00000c30| 6f 77 20 74 68 65 6d 20 | 28 6f 74 68 65 72 77 69 |ow them |(otherwi|
|00000c40| 73 65 20 68 65 27 6c 6c | 20 68 61 76 65 20 74 6f |se he'll| have to|
|00000c50| 20 64 65 62 75 67 20 68 | 69 73 20 63 6f 64 65 29 | debug h|is code)|
|00000c60| 2c 0d 2a 20 6f 72 20 79 | 6f 75 20 70 72 6f 76 69 |,.* or y|ou provi|
|00000c70| 64 65 20 6d 6f 73 74 20 | 6f 66 20 74 68 65 20 68 |de most |of the h|
|00000c80| 65 6c 70 20 62 79 20 75 | 73 69 6e 67 20 74 68 65 |elp by u|sing the|
|00000c90| 20 65 78 65 63 70 74 69 | 6f 6e 0d 20 20 68 61 6e | execpti|on. han|
|00000ca0| 64 6c 69 6e 67 2e 0d 0d | 0d 52 61 69 73 69 6e 67 |dling...|.Raising|
|00000cb0| 20 45 78 63 65 70 74 69 | 6f 6e 73 0d 2d 2d 2d 2d | Excepti|ons.----|
|00000cc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0d 0d |--------|------..|
|00000cd0| 57 68 65 6e 20 79 6f 75 | 20 64 65 74 65 63 74 20 |When you| detect |
|00000ce0| 61 6e 20 65 72 72 6f 72 | 20 63 6f 6e 64 69 74 69 |an error| conditi|
|00000cf0| 6f 6e 20 69 6e 20 79 6f | 75 72 20 73 75 62 72 6f |on in yo|ur subro|
|00000d00| 75 74 69 6e 65 2c 0d 61 | 6e 64 20 79 6f 75 20 77 |utine,.a|nd you w|
|00000d10| 61 6e 74 20 74 6f 20 68 | 61 6e 64 6c 65 20 69 74 |ant to h|andle it|
|00000d20| 2c 20 74 68 65 20 63 6c | 61 73 73 69 63 20 77 61 |, the cl|assic wa|
|00000d30| 79 20 77 6f 75 6c 64 20 | 6c 6f 6f 6b 0d 6c 69 6b |y would |look.lik|
|00000d40| 65 20 74 68 69 73 3a 0d | 0d 20 20 2f 2f 20 6d 61 |e this:.|. // ma|
|00000d50| 6b 65 20 73 75 72 65 20 | 74 68 61 74 20 74 68 65 |ke sure |that the|
|00000d60| 20 70 61 73 73 65 64 20 | 6e 75 6d 62 65 72 20 69 | passed |number i|
|00000d70| 73 20 70 6f 73 69 74 69 | 76 65 3a 0d 20 20 49 46 |s positi|ve:. IF|
|00000d80| 20 70 6f 73 4e 75 6d 20 | 3c 20 30 20 54 48 45 4e | posNum |< 0 THEN|
|00000d90| 0d 20 20 20 20 2f 2f 20 | 6f 6f 70 73 20 2d 20 65 |. // |oops - e|
|00000da0| 72 72 6f 72 21 0d 20 20 | 20 20 52 45 54 55 52 4e |rror!. | RETURN|
|00000db0| 0d 20 20 45 4e 44 0d 20 | 20 49 46 20 66 69 6c 65 |. END. | IF file|
|00000dc0| 52 65 66 20 3d 20 4e 49 | 4c 20 54 48 45 4e 0d 20 |Ref = NI|L THEN. |
|00000dd0| 20 20 20 2f 2f 20 6f 6f | 70 73 20 2d 20 61 6e 6f | // oo|ps - ano|
|00000de0| 74 68 65 72 20 65 72 72 | 6f 72 21 0d 20 20 20 20 |ther err|or!. |
|00000df0| 52 45 54 55 52 4e 0d 20 | 20 45 4e 44 0d 20 20 2f |RETURN. | END. /|
|00000e00| 2f 20 2e 2e 2e 20 67 6f | 20 6f 6e 20 77 69 74 68 |/ ... go| on with|
|00000e10| 20 74 68 65 20 6e 6f 72 | 6d 61 6c 20 70 72 6f 63 | the nor|mal proc|
|00000e20| 65 73 73 0d 0d 57 68 69 | 6c 65 20 74 68 61 74 20 |ess..Whi|le that |
|00000e30| 74 61 6b 65 73 20 63 61 | 72 65 20 6f 66 20 6d 61 |takes ca|re of ma|
|00000e40| 6b 69 6e 67 20 79 6f 75 | 72 20 63 6f 64 65 20 66 |king you|r code f|
|00000e50| 61 69 6c 2d 70 72 6f 6f | 66 2c 0d 69 74 20 64 6f |ail-proo|f,.it do|
|00000e60| 65 73 20 6e 6f 74 20 74 | 65 6c 6c 20 74 68 65 20 |es not t|ell the |
|00000e70| 63 61 6c 6c 65 72 20 74 | 68 61 74 20 68 65 20 64 |caller t|hat he d|
|00000e80| 69 64 6e 27 74 20 6d 65 | 65 74 20 79 6f 75 72 0d |idn't me|et your.|
|00000e90| 63 6f 6e 64 69 74 69 6f | 6e 73 2e 0d 0d 59 6f 75 |conditio|ns...You|
|00000ea0| 20 63 6f 75 6c 64 20 65 | 69 74 68 65 72 20 68 61 | could e|ither ha|
|00000eb0| 6e 64 6c 65 20 74 68 61 | 74 20 62 79 20 72 65 74 |ndle tha|t by ret|
|00000ec0| 75 72 6e 69 6e 67 20 73 | 6f 6d 65 20 76 61 6c 75 |urning s|ome valu|
|00000ed0| 65 0d 74 68 61 74 20 74 | 65 6c 6c 73 20 74 68 65 |e.that t|ells the|
|00000ee0| 20 63 61 6c 6c 65 72 20 | 77 68 65 74 68 65 72 20 | caller |whether |
|00000ef0| 68 65 20 64 69 64 20 65 | 76 65 72 79 74 68 69 6e |he did e|verythin|
|00000f00| 67 20 72 69 67 68 74 0d | 6f 72 20 6e 6f 74 2e 20 |g right.|or not. |
|00000f10| 48 6f 77 65 76 65 72 2c | 20 74 68 61 74 20 72 65 |However,| that re|
|00000f20| 71 75 69 72 65 73 20 74 | 68 61 74 20 74 68 65 20 |quires t|hat the |
|00000f30| 63 61 6c 6c 65 72 20 6e | 6f 74 0d 6f 6e 6c 79 20 |caller n|ot.only |
|00000f40| 61 64 64 73 20 63 6f 64 | 65 20 74 6f 20 72 65 74 |adds cod|e to ret|
|00000f50| 72 69 65 76 65 20 74 68 | 61 74 20 61 64 64 69 74 |rieve th|at addit|
|00000f60| 69 6f 6e 61 6c 20 72 65 | 74 75 72 6e 0d 76 61 6c |ional re|turn.val|
|00000f70| 75 65 2c 20 62 75 74 20 | 74 68 61 74 20 68 65 20 |ue, but |that he |
|00000f80| 61 6c 73 6f 20 63 68 65 | 63 6b 73 20 74 68 65 20 |also che|cks the |
|00000f90| 76 61 6c 75 65 20 61 6e | 64 20 68 61 6e 64 6c 65 |value an|d handle|
|00000fa0| 73 0d 69 74 20 61 63 63 | 6f 72 64 69 6e 67 6c 79 |s.it acc|ordingly|
|00000fb0| 2e 0d 0d 4f 72 2c 20 79 | 6f 75 20 63 6f 75 6c 64 |...Or, y|ou could|
|00000fc0| 20 73 69 6d 70 6c 79 20 | 73 69 67 6e 61 6c 20 74 | simply |signal t|
|00000fd0| 68 65 20 65 72 72 6f 72 | 20 63 6f 6e 64 69 74 69 |he error| conditi|
|00000fe0| 6f 6e 0d 62 79 20 75 73 | 69 6e 67 20 74 68 65 20 |on.by us|ing the |
|00000ff0| 4d 73 67 42 6f 78 28 29 | 20 70 72 6f 63 65 64 75 |MsgBox()| procedu|
|00001000| 72 65 20 6c 69 6b 65 20 | 74 68 69 73 3a 0d 0d 20 |re like |this:.. |
|00001010| 20 49 46 20 70 6f 73 4e | 75 6d 20 3c 20 30 20 54 | IF posN|um < 0 T|
|00001020| 48 45 4e 0d 20 20 20 20 | 4d 73 67 42 6f 78 20 22 |HEN. |MsgBox "|
|00001030| 65 72 72 6f 72 20 69 6e | 20 41 64 64 4c 69 6e 65 |error in| AddLine|
|00001040| 54 6f 54 65 78 74 66 69 | 6c 65 3a 20 70 6f 73 4e |ToTextfi|le: posN|
|00001050| 75 6d 20 3c 20 30 21 22 | 0d 20 20 20 20 52 45 54 |um < 0!"|. RET|
|00001060| 55 52 4e 0d 20 20 45 4e | 44 0d 0d 54 68 61 74 2c |URN. EN|D..That,|
|00001070| 20 68 6f 77 65 76 65 72 | 2c 20 69 73 20 6e 6f 74 | however|, is not|
|00001080| 20 72 65 63 6f 6d 6d 65 | 6e 64 65 64 2c 20 62 65 | recomme|nded, be|
|00001090| 63 61 75 73 65 0d 2a 20 | 68 61 72 64 2d 63 6f 64 |cause.* |hard-cod|
|000010a0| 65 64 20 74 65 78 74 20 | 69 73 20 68 61 72 64 20 |ed text |is hard |
|000010b0| 74 6f 20 6c 6f 63 61 6c | 69 7a 65 20 66 6f 72 20 |to local|ize for |
|000010c0| 66 6f 72 65 69 67 6e 0d | 20 20 6c 61 6e 67 75 61 |foreign.| langua|
|000010d0| 67 65 73 2c 0d 2a 20 74 | 68 65 20 63 61 6c 6c 65 |ges,.* t|he calle|
|000010e0| 72 20 6d 69 67 68 74 20 | 6e 6f 74 20 65 78 70 65 |r might |not expe|
|000010f0| 63 74 20 61 74 20 61 6c | 6c 20 74 68 61 74 20 61 |ct at al|l that a|
|00001100| 20 66 69 6c 65 2d 0d 20 | 20 61 63 63 65 73 73 69 | file-. | accessi|
|00001110| 6e 67 20 66 75 6e 63 74 | 69 6f 6e 20 63 61 6e 20 |ng funct|ion can |
|00001120| 63 61 75 73 65 20 61 20 | 75 73 65 72 20 69 6e 74 |cause a |user int|
|00001130| 65 72 61 63 74 69 6f 6e | 2c 0d 2a 20 74 68 65 20 |eraction|,.* the |
|00001140| 63 61 6c 6c 65 72 20 73 | 74 69 6c 6c 20 69 73 6e |caller s|till isn|
|00001150| 27 74 20 61 62 6c 65 20 | 74 6f 20 68 61 6e 64 6c |'t able |to handl|
|00001160| 65 20 74 68 65 20 65 72 | 72 6f 72 0d 20 20 63 6f |e the er|ror. co|
|00001170| 6e 64 69 74 69 6f 6e 20 | 62 79 20 68 69 6d 73 65 |ndition |by himse|
|00001180| 6c 66 2e 0d 0d 52 61 69 | 73 69 6e 67 20 61 6e 20 |lf...Rai|sing an |
|00001190| 45 78 63 65 70 74 69 6f | 6e 20 73 6f 6c 76 65 64 |Exceptio|n solved|
|000011a0| 20 61 6c 6c 20 74 68 65 | 73 65 20 70 72 6f 62 6c | all the|se probl|
|000011b0| 65 6d 73 2e 0d 48 65 72 | 65 27 73 20 68 6f 77 20 |ems..Her|e's how |
|000011c0| 69 74 20 77 6f 75 6c 64 | 20 6c 6f 6f 6b 20 6c 69 |it would| look li|
|000011d0| 6b 65 20 69 6e 20 79 6f | 75 72 20 63 6f 64 65 3a |ke in yo|ur code:|
|000011e0| 0d 0d 20 20 49 46 20 70 | 6f 73 4e 75 6d 20 3c 20 |.. IF p|osNum < |
|000011f0| 30 20 54 48 45 4e 0d 20 | 20 20 20 52 61 69 73 65 |0 THEN. | Raise|
|00001200| 20 6e 65 77 20 52 75 6e | 74 69 6d 65 45 78 63 65 | new Run|timeExce|
|00001210| 70 74 69 6f 6e 0d 20 20 | 45 4e 44 0d 20 20 49 46 |ption. |END. IF|
|00001220| 20 66 69 6c 65 52 65 66 | 20 3d 20 4e 49 4c 20 54 | fileRef| = NIL T|
|00001230| 48 45 4e 0d 20 20 20 20 | 52 61 69 73 65 20 6e 65 |HEN. |Raise ne|
|00001240| 77 20 52 75 6e 74 69 6d | 65 45 78 63 65 70 74 69 |w Runtim|eExcepti|
|00001250| 6f 6e 0d 20 20 45 4e 44 | 0d 0d 49 66 20 79 6f 75 |on. END|..If you|
|00001260| 20 72 61 69 73 65 20 61 | 6e 20 45 78 63 65 70 74 | raise a|n Except|
|00001270| 69 6f 6e 20 69 6e 20 79 | 6f 75 72 20 63 6f 64 65 |ion in y|our code|
|00001280| 2c 20 69 74 20 77 6f 72 | 6b 73 0d 6c 69 6b 65 20 |, it wor|ks.like |
|00001290| 74 68 69 73 3a 20 46 69 | 72 73 74 2c 20 69 74 20 |this: Fi|rst, it |
|000012a0| 61 63 74 73 20 61 73 20 | 69 66 20 79 6f 75 20 68 |acts as |if you h|
|000012b0| 61 64 20 75 73 65 64 20 | 74 68 65 20 52 45 54 55 |ad used |the RETU|
|000012c0| 52 4e 0d 73 74 61 74 65 | 6d 65 6e 74 20 69 6e 73 |RN.state|ment ins|
|000012d0| 74 65 61 64 3a 20 54 68 | 65 20 70 72 6f 63 65 64 |tead: Th|e proced|
|000012e0| 75 72 65 20 77 69 6c 6c | 20 62 65 20 65 78 69 74 |ure will| be exit|
|000012f0| 65 64 2e 0d 41 6e 64 20 | 68 65 72 65 20 63 6f 6d |ed..And |here com|
|00001300| 65 73 20 74 68 65 20 73 | 6d 61 72 74 20 70 61 72 |es the s|mart par|
|00001310| 74 3a 20 49 66 20 74 68 | 65 20 63 61 6c 6c 69 6e |t: If th|e callin|
|00001320| 67 0d 70 72 6f 63 65 64 | 75 72 65 20 64 6f 65 73 |g.proced|ure does|
|00001330| 20 6e 6f 74 20 65 78 70 | 6c 69 63 69 74 6c 79 20 | not exp|licitly |
|00001340| 68 61 6e 64 6c 65 20 74 | 68 65 20 65 78 63 65 70 |handle t|he excep|
|00001350| 74 69 6f 6e 2c 0d 69 74 | 20 77 69 6c 6c 20 6e 6f |tion,.it| will no|
|00001360| 74 20 67 65 74 20 66 6f | 72 67 6f 74 74 65 6e 20 |t get fo|rgotten |
|00001370| 28 61 73 20 69 6e 20 74 | 68 65 20 63 61 73 65 20 |(as in t|he case |
|00001380| 77 68 65 6e 20 79 6f 75 | 0d 68 61 64 20 72 65 74 |when you|.had ret|
|00001390| 75 72 6e 65 64 20 61 20 | 73 75 63 63 65 73 73 20 |urned a |success |
|000013a0| 76 61 6c 75 65 29 2c 20 | 62 75 74 20 77 69 6c 6c |value), |but will|
|000013b0| 20 67 65 74 20 70 61 73 | 73 65 64 0d 6f 6e 20 74 | get pas|sed.on t|
|000013c0| 6f 20 69 74 73 20 63 61 | 6c 6c 65 72 2c 20 61 6e |o its ca|ller, an|
|000013d0| 64 20 74 68 65 6e 20 74 | 6f 20 74 68 61 74 20 6f |d then t|o that o|
|000013e0| 6e 65 27 73 20 63 61 6c | 6c 65 72 2c 0d 61 6e 64 |ne's cal|ler,.and|
|000013f0| 20 73 6f 20 6f 6e 2c 20 | 75 6e 74 69 6c 20 61 74 | so on, |until at|
|00001400| 20 6f 6e 65 20 6f 75 74 | 73 69 64 65 20 70 72 6f | one out|side pro|
|00001410| 63 65 64 75 72 65 20 74 | 68 65 0d 65 78 63 65 70 |cedure t|he.excep|
|00001420| 74 69 6f 6e 20 69 73 20 | 74 61 6b 65 6e 20 63 61 |tion is |taken ca|
|00001430| 72 65 20 6f 66 2e 20 49 | 66 20 6e 6f 20 6f 6e 65 |re of. I|f no one|
|00001440| 20 68 61 6e 64 6c 65 73 | 20 74 68 65 0d 65 78 63 | handles| the.exc|
|00001450| 65 70 74 69 6f 6e 20 65 | 78 70 6c 69 63 69 74 6c |eption e|xplicitl|
|00001460| 79 2c 20 52 42 20 77 69 | 6c 6c 20 69 6e 76 6f 6b |y, RB wi|ll invok|
|00001470| 65 20 61 20 73 74 61 6e | 64 61 72 64 0d 65 72 72 |e a stan|dard.err|
|00001480| 6f 72 20 64 69 61 6c 6f | 67 20 74 68 61 74 20 73 |or dialo|g that s|
|00001490| 74 6f 70 73 20 65 78 65 | 63 75 74 69 6f 6e 20 6f |tops exe|cution o|
|000014a0| 66 20 79 6f 75 72 20 61 | 70 70 6c 69 63 61 74 69 |f your a|pplicati|
|000014b0| 6f 6e 0d 61 6e 64 20 73 | 68 6f 77 73 20 79 6f 75 |on.and s|hows you|
|000014c0| 20 74 68 65 20 65 72 72 | 6f 72 20 63 6f 6e 64 69 | the err|or condi|
|000014d0| 74 69 6f 6e 20 69 6e 20 | 74 68 65 20 65 64 69 74 |tion in |the edit|
|000014e0| 6f 72 2e 0d 0d 0d 48 61 | 6e 64 6c 69 6e 67 20 45 |or....Ha|ndling E|
|000014f0| 78 63 65 70 74 69 6f 6e | 73 0d 2d 2d 2d 2d 2d 2d |xception|s.------|
|00001500| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 0d 0d 53 |--------|-----..S|
|00001510| 6f 2c 20 74 6f 20 68 61 | 6e 64 6c 65 20 74 68 65 |o, to ha|ndle the|
|00001520| 20 65 78 63 65 70 74 69 | 6f 6e 2c 20 79 6f 75 27 | excepti|on, you'|
|00001530| 6c 6c 20 68 61 76 65 20 | 74 6f 20 61 64 64 0d 61 |ll have |to add.a|
|00001540| 20 73 6f 2d 63 61 6c 6c | 65 64 20 65 78 65 70 74 | so-call|ed exept|
|00001550| 69 6f 6e 20 68 61 6e 64 | 6c 65 72 20 74 6f 20 74 |ion hand|ler to t|
|00001560| 68 65 20 65 6e 64 20 6f | 66 20 79 6f 75 72 0d 70 |he end o|f your.p|
|00001570| 72 6f 63 65 64 75 72 65 | 3a 0d 0d 20 20 53 75 62 |rocedure|:.. Sub|
|00001580| 20 57 72 69 74 65 53 6f | 6d 65 4c 69 6e 65 73 54 | WriteSo|meLinesT|
|00001590| 6f 41 46 69 6c 65 28 29 | 0d 20 20 20 20 2e 2e 2e |oAFile()|. ...|
|000015a0| 0d 20 20 45 78 63 65 70 | 74 69 6f 6e 20 65 78 63 |. Excep|tion exc|
|000015b0| 20 61 73 20 52 75 6e 74 | 69 6d 65 45 78 63 65 70 | as Runt|imeExcep|
|000015c0| 74 69 6f 6e 0d 20 20 20 | 20 4d 73 67 42 6f 78 20 |tion. | MsgBox |
|000015d0| 22 6f 6f 70 73 20 2d 20 | 74 68 65 72 65 27 73 20 |"oops - |there's |
|000015e0| 73 6f 6d 65 74 68 69 6e | 67 20 77 72 6f 6e 67 22 |somethin|g wrong"|
|000015f0| 0d 20 20 45 6e 64 20 53 | 75 62 0d 0d 43 61 74 63 |. End S|ub..Catc|
|00001600| 68 69 6e 67 20 65 78 63 | 65 70 74 69 6f 6e 73 20 |hing exc|eptions |
|00001610| 61 73 20 73 65 65 6e 20 | 61 62 6f 76 65 20 69 73 |as seen |above is|
|00001620| 20 74 68 65 20 6d 6f 73 | 74 20 67 65 6e 65 72 69 | the mos|t generi|
|00001630| 63 0d 77 61 79 20 6f 66 | 20 63 61 74 63 68 69 6e |c.way of| catchin|
|00001640| 67 20 61 6e 79 20 65 78 | 63 65 70 74 69 6f 6e 73 |g any ex|ceptions|
|00001650| 20 69 6e 20 79 6f 75 72 | 20 61 70 70 6c 69 63 61 | in your| applica|
|00001660| 74 69 6f 6e 2c 0d 69 6e | 63 6c 75 64 69 6e 67 20 |tion,.in|cluding |
|00001670| 63 61 73 65 73 20 6f 66 | 20 75 73 69 6e 67 20 61 |cases of| using a|
|00001680| 20 6e 6f 6e 2d 65 78 69 | 73 74 69 6e 67 73 20 4f | non-exi|stings O|
|00001690| 62 6a 65 63 74 20 28 68 | 61 70 70 65 6e 73 0d 77 |bject (h|appens.w|
|000016a0| 68 65 6e 20 61 6e 20 6f | 62 6a 65 63 74 20 72 65 |hen an o|bject re|
|000016b0| 66 65 72 65 6e 63 65 20 | 69 73 20 4e 49 4c 29 2c |ference |is NIL),|
|000016c0| 20 61 20 73 74 61 63 6b | 20 6f 76 65 72 66 6c 6f | a stack| overflo|
|000016d0| 77 0d 28 68 61 70 70 65 | 6e 73 20 77 68 65 6e 20 |w.(happe|ns when |
|000016e0| 73 75 62 72 6f 75 74 69 | 6e 65 73 20 61 72 65 20 |subrouti|nes are |
|000016f0| 74 6f 6f 20 64 65 65 70 | 6c 79 20 6e 65 73 74 65 |too deep|ly neste|
|00001700| 64 2c 0d 65 73 70 65 63 | 69 61 6c 6c 79 20 69 6e |d,.espec|ially in|
|00001710| 20 72 65 63 75 72 73 69 | 76 65 20 63 61 6c 6c 69 | recursi|ve calli|
|00001720| 6e 67 29 2c 20 61 6e 64 | 20 61 72 72 61 79 20 69 |ng), and| array i|
|00001730| 6e 64 65 78 69 6e 67 0d | 65 72 72 6f 72 73 20 28 |ndexing.|errors (|
|00001740| 77 68 65 6e 20 74 68 65 | 20 61 64 64 72 65 73 73 |when the| address|
|00001750| 65 64 20 61 72 72 61 79 | 20 65 6c 65 6d 65 6e 74 |ed array| element|
|00001760| 20 69 73 20 6f 75 74 20 | 6f 66 0d 69 74 73 20 62 | is out |of.its b|
|00001770| 6f 75 6e 64 73 29 2e 0d | 0d 57 68 65 6e 20 79 6f |ounds)..|.When yo|
|00001780| 75 20 61 64 64 20 73 75 | 63 68 20 63 6f 64 65 20 |u add su|ch code |
|00001790| 74 6f 20 61 6c 6c 20 6f | 66 20 79 6f 75 72 20 79 |to all o|f your y|
|000017a0| 6f 75 72 20 65 76 65 6e | 74 0d 68 61 6e 64 6c 65 |our even|t.handle|
|000017b0| 72 20 72 6f 75 74 69 6e | 65 73 2c 20 79 6f 75 20 |r routin|es, you |
|000017c0| 77 69 6c 6c 20 62 65 20 | 61 62 6c 65 20 74 6f 20 |will be |able to |
|000017d0| 74 72 61 70 20 61 6e 79 | 0d 65 72 72 6f 72 20 63 |trap any|.error c|
|000017e0| 6f 6e 64 69 74 69 6f 6e | 73 20 69 6e 20 79 6f 75 |ondition|s in you|
|000017f0| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 61 6e |r applic|ation an|
|00001800| 79 20 67 72 61 63 65 66 | 75 6c 6c 79 0d 68 61 6e |y gracef|ully.han|
|00001810| 64 6c 69 6e 67 20 74 68 | 65 6d 20 69 6e 73 74 65 |dling th|em inste|
|00001820| 61 64 20 6f 66 20 68 61 | 76 69 6e 67 20 79 6f 75 |ad of ha|ving you|
|00001830| 72 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 0d 61 75 |r applic|ation.au|
|00001840| 74 6f 6d 61 74 69 63 61 | 6c 6c 79 20 71 75 69 74 |tomatica|lly quit|
|00001850| 20 65 61 63 68 20 74 69 | 6d 65 20 73 75 63 68 20 | each ti|me such |
|00001860| 61 20 65 78 63 65 70 74 | 69 6f 6e 20 6f 63 63 75 |a except|ion occu|
|00001870| 72 73 2e 0d 0d 0d 43 72 | 65 61 74 69 6e 67 20 79 |rs....Cr|eating y|
|00001880| 6f 75 72 20 6f 77 6e 20 | 45 78 63 65 70 74 69 6f |our own |Exceptio|
|00001890| 6e 20 74 79 70 65 73 0d | 2d 2d 2d 2d 2d 2d 2d 2d |n types.|--------|
|000018a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000018b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 0d 0d 52 61 69 73 69 |--------|-..Raisi|
|000018c0| 6e 67 20 61 20 22 52 75 | 6e 74 69 6d 65 45 78 63 |ng a "Ru|ntimeExc|
|000018d0| 65 70 74 69 6f 6e 22 20 | 69 73 20 61 20 67 65 6e |eption" |is a gen|
|000018e0| 65 72 69 63 20 61 6e 64 | 0d 71 75 69 74 65 20 75 |eric and|.quite u|
|000018f0| 6e 73 70 65 63 69 66 69 | 63 20 6d 65 73 73 61 67 |nspecifi|c messag|
|00001900| 65 20 74 6f 20 74 68 65 | 20 63 61 6c 6c 65 72 2e |e to the| caller.|
|00001910| 20 49 74 20 77 6f 75 6c | 64 20 62 65 0d 6e 69 63 | It woul|d be.nic|
|00001920| 65 72 20 69 66 20 74 68 | 65 20 73 75 62 72 6f 75 |er if th|e subrou|
|00001930| 74 69 6e 65 20 63 61 6e | 20 72 61 69 73 65 20 69 |tine can| raise i|
|00001940| 74 73 20 65 78 63 65 70 | 74 69 6f 6e 73 0d 77 69 |ts excep|tions.wi|
|00001950| 74 68 20 73 6f 6d 65 20 | 6d 6f 72 65 20 69 6e 66 |th some |more inf|
|00001960| 6f 72 6d 61 74 69 6f 6e | 2c 20 6c 69 6b 65 20 61 |ormation|, like a|
|00001970| 20 74 65 78 74 20 6d 65 | 73 73 61 67 65 0d 65 78 | text me|ssage.ex|
|00001980| 70 6c 61 69 6e 69 6e 67 | 20 74 68 65 20 65 72 72 |plaining| the err|
|00001990| 6f 72 20 63 6f 6e 64 69 | 74 69 6f 6e 20 69 6e 20 |or condi|tion in |
|000019a0| 6d 6f 72 65 20 64 65 74 | 61 69 6c 20 6f 72 0d 65 |more det|ail or.e|
|000019b0| 76 65 6e 20 67 69 76 69 | 6e 67 20 6d 6f 72 65 20 |ven givi|ng more |
|000019c0| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 20 61 62 6f 75 |informat|ion abou|
|000019d0| 74 20 74 68 65 20 70 61 | 72 61 6d 65 74 65 72 73 |t the pa|rameters|
|000019e0| 0d 74 68 61 74 20 61 72 | 65 20 62 6f 75 6e 64 20 |.that ar|e bound |
|000019f0| 74 6f 20 74 68 65 20 63 | 6f 6e 64 69 74 69 6f 6e |to the c|ondition|
|00001a00| 20 28 6c 69 6b 65 20 74 | 68 65 20 66 69 6c 65 20 | (like t|he file |
|00001a10| 6e 61 6d 65 0d 6f 72 20 | 74 68 65 20 76 61 6c 75 |name.or |the valu|
|00001a20| 65 20 6f 66 20 74 68 65 | 20 6e 6f 6e 2d 70 6f 73 |e of the| non-pos|
|00001a30| 69 74 69 76 65 20 6e 75 | 6d 62 65 72 29 2e 0d 0d |itive nu|mber)...|
|00001a40| 46 6f 72 20 74 68 61 74 | 2c 20 77 65 20 68 61 76 |For that|, we hav|
|00001a50| 65 20 74 6f 20 63 72 65 | 61 74 65 20 61 20 6e 65 |e to cre|ate a ne|
|00001a60| 77 20 73 75 62 63 6c 61 | 73 73 20 6f 66 0d 61 20 |w subcla|ss of.a |
|00001a70| 22 52 75 6e 74 69 6d 65 | 45 78 63 65 70 74 69 6f |"Runtime|Exceptio|
|00001a80| 6e 22 20 63 6c 61 73 73 | 3a 20 49 6e 20 74 68 65 |n" class|: In the|
|00001a90| 20 52 42 20 65 64 69 74 | 6f 72 2c 0d 63 72 65 61 | RB edit|or,.crea|
|00001aa0| 74 65 20 61 20 6e 65 77 | 20 63 6c 61 73 73 2c 20 |te a new| class, |
|00001ab0| 6e 61 6d 65 20 69 74 20 | 22 4d 79 53 70 65 63 69 |name it |"MySpeci|
|00001ac0| 61 6c 45 78 63 65 70 74 | 69 6f 6e 22 0d 61 6e 64 |alExcept|ion".and|
|00001ad0| 20 73 65 74 20 69 74 73 | 20 53 75 70 65 72 20 63 | set its| Super c|
|00001ae0| 6c 61 73 73 20 74 6f 20 | 52 75 6e 74 69 6d 65 45 |lass to |RuntimeE|
|00001af0| 78 63 65 70 74 69 6f 6e | 2e 0d 0d 4e 6f 77 2c 20 |xception|...Now, |
|00001b00| 69 6e 73 74 65 61 64 20 | 6f 66 20 72 61 69 73 69 |instead |of raisi|
|00001b10| 6e 67 20 61 20 52 75 6e | 74 69 6d 65 45 78 63 65 |ng a Run|timeExce|
|00001b20| 70 74 69 6f 6e 2c 0d 77 | 65 20 63 61 6e 20 72 61 |ption,.w|e can ra|
|00001b30| 69 73 65 20 6f 75 72 20 | 6f 77 6e 20 6f 6e 65 3a |ise our |own one:|
|00001b40| 0d 0d 20 20 49 46 20 70 | 6f 73 4e 75 6d 20 3c 20 |.. IF p|osNum < |
|00001b50| 30 20 54 48 45 4e 0d 20 | 20 20 20 52 61 69 73 65 |0 THEN. | Raise|
|00001b60| 20 6e 65 77 20 4d 79 53 | 70 65 63 69 61 6c 45 78 | new MyS|pecialEx|
|00001b70| 63 65 70 74 69 6f 6e 0d | 20 20 45 4e 44 0d 0d 49 |ception.| END..I|
|00001b80| 6e 20 61 6e 20 65 78 63 | 65 70 74 69 6f 6e 20 68 |n an exc|eption h|
|00001b90| 61 6e 64 6c 65 72 2c 20 | 77 65 20 63 61 6e 20 6d |andler, |we can m|
|00001ba0| 61 6b 65 20 75 73 65 20 | 6f 66 20 74 68 69 73 3a |ake use |of this:|
|00001bb0| 0d 0d 20 20 45 78 63 65 | 70 74 69 6f 6e 20 65 78 |.. Exce|ption ex|
|00001bc0| 63 20 61 73 20 52 75 6e | 74 69 6d 65 45 78 63 65 |c as Run|timeExce|
|00001bd0| 70 74 69 6f 6e 0d 20 20 | 20 20 49 46 20 65 78 63 |ption. | IF exc|
|00001be0| 20 69 73 41 20 4d 79 53 | 70 65 63 69 61 6c 45 78 | isA MyS|pecialEx|
|00001bf0| 63 65 70 74 69 6f 6e 20 | 54 48 45 4e 0d 20 20 20 |ception |THEN. |
|00001c00| 20 20 20 4d 73 67 42 6f | 78 20 22 6f 6f 70 73 20 | MsgBo|x "oops |
|00001c10| 2d 20 41 64 64 4c 69 6e | 65 54 6f 54 65 78 74 66 |- AddLin|eToTextf|
|00001c20| 69 6c 65 20 66 61 69 6c | 65 64 22 0d 20 20 20 20 |ile fail|ed". |
|00001c30| 45 4c 53 45 0d 20 20 20 | 20 20 20 4d 73 67 42 6f |ELSE. | MsgBo|
|00001c40| 78 20 22 6f 6f 70 73 20 | 2d 20 74 68 65 72 65 27 |x "oops |- there'|
|00001c50| 73 20 73 6f 6d 65 74 68 | 69 6e 67 20 65 6c 73 65 |s someth|ing else|
|00001c60| 20 77 72 6f 6e 67 22 0d | 20 20 20 20 45 4e 44 0d | wrong".| END.|
|00001c70| 20 20 45 6e 64 20 53 75 | 62 0d 0d 4e 6f 77 2c 20 | End Su|b..Now, |
|00001c80| 73 69 6e 63 65 20 77 65 | 20 64 6f 20 6e 6f 74 20 |since we| do not |
|00001c90| 77 61 6e 74 20 74 6f 20 | 68 61 6e 64 6c 65 20 74 |want to |handle t|
|00001ca0| 68 6f 73 65 20 75 6e 6b | 6e 6f 77 6e 0d 65 78 63 |hose unk|nown.exc|
|00001cb0| 65 70 74 69 6f 6e 73 20 | 69 6e 20 6f 75 72 20 57 |eptions |in our W|
|00001cc0| 72 69 74 65 53 6f 6d 65 | 4c 69 6e 65 73 54 6f 41 |riteSome|LinesToA|
|00001cd0| 46 69 6c 65 20 70 72 6f | 63 65 64 75 72 65 2c 0d |File pro|cedure,.|
|00001ce0| 62 75 74 20 6f 6e 6c 79 | 20 74 68 65 20 65 78 63 |but only| the exc|
|00001cf0| 65 70 74 69 6f 6e 73 20 | 74 68 61 74 20 77 65 20 |eptions |that we |
|00001d00| 61 72 65 20 61 77 61 72 | 65 20 6f 66 20 28 74 68 |are awar|e of (th|
|00001d10| 6f 73 65 0d 65 78 70 6c | 69 63 69 74 6c 79 20 72 |ose.expl|icitly r|
|00001d20| 61 69 73 65 64 20 69 6e | 20 41 64 64 4c 69 6e 65 |aised in| AddLine|
|00001d30| 54 6f 54 65 78 74 66 69 | 6c 65 29 2c 0d 77 65 20 |ToTextfi|le),.we |
|00001d40| 63 61 6e 20 70 61 73 73 | 20 74 68 65 20 6f 74 68 |can pass| the oth|
|00001d50| 65 72 20 65 78 63 65 70 | 74 69 6f 6e 73 20 75 70 |er excep|tions up|
|00001d60| 20 74 6f 20 68 69 67 68 | 65 72 0d 6c 65 76 65 6c | to high|er.level|
|00001d70| 73 20 69 6e 20 74 68 65 | 20 63 61 6c 6c 69 6e 67 |s in the| calling|
|00001d80| 20 73 74 61 63 6b 20 62 | 79 20 72 61 69 73 69 6e | stack b|y raisin|
|00001d90| 67 20 74 68 65 6d 20 61 | 67 61 69 6e 3a 0d 0d 20 |g them a|gain:.. |
|00001da0| 20 45 78 63 65 70 74 69 | 6f 6e 20 65 78 63 20 61 | Excepti|on exc a|
|00001db0| 73 20 52 75 6e 74 69 6d | 65 45 78 63 65 70 74 69 |s Runtim|eExcepti|
|00001dc0| 6f 6e 0d 20 20 20 20 49 | 46 20 65 78 63 20 69 73 |on. I|F exc is|
|00001dd0| 41 20 4d 79 53 70 65 63 | 69 61 6c 45 78 63 65 70 |A MySpec|ialExcep|
|00001de0| 74 69 6f 6e 20 54 48 45 | 4e 0d 20 20 20 20 20 20 |tion THE|N. |
|00001df0| 4d 73 67 42 6f 78 20 22 | 6f 6f 70 73 20 2d 20 41 |MsgBox "|oops - A|
|00001e00| 64 64 4c 69 6e 65 54 6f | 54 65 78 74 66 69 6c 65 |ddLineTo|Textfile|
|00001e10| 20 66 61 69 6c 65 64 22 | 0d 20 20 20 20 45 4c 53 | failed"|. ELS|
|00001e20| 45 0d 20 20 20 20 20 20 | 2f 2f 20 73 6f 6d 65 20 |E. |// some |
|00001e30| 6f 74 68 65 72 20 65 78 | 63 65 70 74 69 6f 6e 20 |other ex|ception |
|00001e40| 2d 20 77 65 20 64 6f 6e | 27 74 20 68 61 6e 64 6c |- we don|'t handl|
|00001e50| 65 20 74 68 61 74 20 68 | 65 72 65 0d 20 20 20 20 |e that h|ere. |
|00001e60| 20 20 52 61 69 73 65 20 | 65 78 63 0d 20 20 20 20 | Raise |exc. |
|00001e70| 45 4e 44 0d 20 20 45 6e | 64 20 53 75 62 0d 0d 41 |END. En|d Sub..A|
|00001e80| 73 20 61 20 73 68 6f 72 | 74 20 66 6f 72 6d 2c 20 |s a shor|t form, |
|00001e90| 74 68 65 20 61 62 6f 76 | 65 20 63 61 6e 20 62 65 |the abov|e can be|
|00001ea0| 20 77 72 69 74 74 65 6e | 20 6c 69 6b 65 20 74 68 | written| like th|
|00001eb0| 69 73 3a 0d 0d 20 20 45 | 78 63 65 70 74 69 6f 6e |is:.. E|xception|
|00001ec0| 20 65 78 63 20 61 73 20 | 4d 79 53 70 65 63 69 61 | exc as |MySpecia|
|00001ed0| 6c 45 78 63 65 70 74 69 | 6f 6e 0d 20 20 20 20 4d |lExcepti|on. M|
|00001ee0| 73 67 42 6f 78 20 22 6f | 6f 70 73 20 2d 20 41 64 |sgBox "o|ops - Ad|
|00001ef0| 64 4c 69 6e 65 54 6f 54 | 65 78 74 66 69 6c 65 20 |dLineToT|extfile |
|00001f00| 66 61 69 6c 65 64 22 0d | 20 20 45 6e 64 20 53 75 |failed".| End Su|
|00001f10| 62 0d 0d 28 74 68 69 73 | 20 6d 65 61 6e 73 20 74 |b..(this| means t|
|00001f20| 68 61 74 20 6f 6e 6c 79 | 20 65 78 63 65 70 74 69 |hat only| excepti|
|00001f30| 6f 6e 73 20 6f 66 20 74 | 79 70 65 20 4d 79 53 70 |ons of t|ype MySp|
|00001f40| 65 63 69 61 6c 45 78 63 | 65 70 74 69 6f 6e 0d 61 |ecialExc|eption.a|
|00001f50| 72 65 20 68 61 6e 64 6c | 65 64 20 68 65 72 65 2c |re handl|ed here,|
|00001f60| 20 61 6c 6c 20 6f 74 68 | 65 72 73 20 61 72 65 20 | all oth|ers are |
|00001f70| 70 61 73 73 65 64 20 6f | 6e 20 74 6f 20 68 69 67 |passed o|n to hig|
|00001f80| 68 65 72 20 6c 65 76 65 | 6c 73 2e 29 0d 0d 0d 41 |her leve|ls.)...A|
|00001f90| 64 64 69 6e 67 20 6d 6f | 72 65 20 69 6e 66 6f 72 |dding mo|re infor|
|00001fa0| 6d 61 74 69 6f 6e 20 74 | 6f 20 45 78 63 65 70 74 |mation t|o Except|
|00001fb0| 69 6f 6e 73 20 79 6f 75 | 20 72 61 69 73 65 0d 2d |ions you| raise.-|
|00001fc0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001fd0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00001fe0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 0d 0d |--------|------..|
|00001ff0| 54 68 61 6e 6b 73 20 74 | 6f 20 74 68 65 20 63 6f |Thanks t|o the co|
|00002000| 6e 63 65 70 74 73 20 6f | 66 20 4f 62 6a 65 63 74 |ncepts o|f Object|
|00002010| 20 4f 72 69 65 6e 74 65 | 64 20 70 72 6f 67 72 61 | Oriente|d progra|
|00002020| 6d 6d 69 6e 67 0d 61 6e | 64 20 74 6f 20 74 68 65 |mming.an|d to the|
|00002030| 20 66 61 63 74 20 74 68 | 61 74 20 61 6e 20 45 78 | fact th|at an Ex|
|00002040| 63 65 70 74 69 6f 6e 20 | 69 73 20 61 6e 20 6f 62 |ception |is an ob|
|00002050| 6a 65 63 74 2c 20 74 6f | 6f 2c 0d 77 65 20 63 61 |ject, to|o,.we ca|
|00002060| 6e 20 62 65 6e 65 66 69 | 74 20 66 72 6f 6d 20 74 |n benefi|t from t|
|00002070| 68 69 73 20 62 79 20 6d | 61 6b 69 6e 67 20 6f 75 |his by m|aking ou|
|00002080| 72 20 65 78 63 65 70 74 | 69 6f 6e 20 73 69 67 6e |r except|ion sign|
|00002090| 61 6c 6c 69 6e 67 0d 65 | 76 65 6e 20 73 6d 61 72 |alling.e|ven smar|
|000020a0| 74 65 72 20 61 6e 64 20 | 71 75 69 74 65 20 75 6e |ter and |quite un|
|000020b0| 69 76 65 72 73 61 6c 3a | 0d 0d 49 6e 20 74 68 65 |iversal:|..In the|
|000020c0| 20 52 42 20 65 64 69 74 | 6f 72 2c 20 6c 65 74 27 | RB edit|or, let'|
|000020d0| 73 20 61 64 64 20 61 20 | 70 72 6f 70 65 72 74 79 |s add a |property|
|000020e0| 20 74 6f 20 74 68 65 0d | 4d 79 53 70 65 63 69 61 | to the.|MySpecia|
|000020f0| 6c 45 78 63 65 70 74 69 | 6f 6e 20 63 6c 61 73 73 |lExcepti|on class|
|00002100| 2e 0d 0d 20 20 41 64 64 | 20 74 68 65 20 70 72 6f |... Add| the pro|
|00002110| 70 65 72 74 79 3a 20 6d | 73 67 20 61 73 20 53 74 |perty: m|sg as St|
|00002120| 72 69 6e 67 0d 0d 4e 6f | 77 2c 20 77 68 65 6e 20 |ring..No|w, when |
|00002130| 77 65 20 72 61 69 73 65 | 20 61 6e 20 65 78 63 65 |we raise| an exce|
|00002140| 70 74 69 6f 6e 20 6f 66 | 20 74 68 61 74 20 74 79 |ption of| that ty|
|00002150| 70 65 2c 20 77 65 0d 63 | 61 6e 20 61 64 64 20 73 |pe, we.c|an add s|
|00002160| 6f 6d 65 20 69 6e 66 6f | 72 6d 61 74 69 6f 6e 20 |ome info|rmation |
|00002170| 69 6e 20 69 74 73 20 6d | 73 67 20 70 72 6f 70 65 |in its m|sg prope|
|00002180| 72 74 79 2c 20 6c 69 6b | 65 0d 74 68 69 73 3a 0d |rty, lik|e.this:.|
|00002190| 0d 20 20 44 69 6d 20 6d | 79 45 78 63 20 61 73 20 |. Dim m|yExc as |
|000021a0| 4d 79 53 70 65 63 69 61 | 6c 45 78 63 65 70 74 69 |MySpecia|lExcepti|
|000021b0| 6f 6e 20 0d 20 20 2e 2e | 2e 0d 20 20 49 46 20 66 |on . ..|.. IF f|
|000021c0| 69 6c 65 52 65 66 20 3d | 20 6e 69 6c 20 54 48 45 |ileRef =| nil THE|
|000021d0| 4e 0d 20 20 20 20 6d 79 | 45 78 63 20 3d 20 6e 65 |N. my|Exc = ne|
|000021e0| 77 20 4d 79 53 70 65 63 | 69 61 6c 45 78 63 65 70 |w MySpec|ialExcep|
|000021f0| 74 69 6f 6e 0d 20 20 20 | 20 6d 79 45 78 63 2e 6d |tion. | myExc.m|
|00002200| 73 67 20 3d 20 22 66 69 | 6c 65 52 65 66 20 3d 20 |sg = "fi|leRef = |
|00002210| 6e 69 6c 20 28 70 6f 73 | 4e 75 6d 20 3d 20 22 20 |nil (pos|Num = " |
|00002220| 2b 20 53 74 72 28 70 6f | 73 4e 75 6d 29 20 2b 20 |+ Str(po|sNum) + |
|00002230| 22 29 22 0d 20 20 20 20 | 52 61 69 73 65 20 6d 79 |")". |Raise my|
|00002240| 45 78 63 0d 20 20 45 4e | 44 0d 20 20 49 46 20 70 |Exc. EN|D. IF p|
|00002250| 6f 73 4e 75 6d 20 3c 20 | 30 20 54 48 45 4e 0d 20 |osNum < |0 THEN. |
|00002260| 20 20 20 6d 79 45 78 63 | 20 3d 20 6e 65 77 20 4d | myExc| = new M|
|00002270| 79 53 70 65 63 69 61 6c | 45 78 63 65 70 74 69 6f |ySpecial|Exceptio|
|00002280| 6e 0d 20 20 20 20 6d 79 | 45 78 63 2e 6d 73 67 20 |n. my|Exc.msg |
|00002290| 3d 20 22 66 69 6c 65 20 | 22 20 2b 20 66 69 6c 65 |= "file |" + file|
|000022a0| 52 65 66 2e 6e 61 6d 65 | 20 2b 20 22 3a 20 70 6f |Ref.name| + ": po|
|000022b0| 73 4e 75 6d 20 3c 20 30 | 22 0d 20 20 20 20 52 61 |sNum < 0|". Ra|
|000022c0| 69 73 65 20 6d 79 45 78 | 63 0d 20 20 45 4e 44 0d |ise myEx|c. END.|
|000022d0| 0d 54 68 65 20 65 78 63 | 65 70 74 69 6f 6e 20 68 |.The exc|eption h|
|000022e0| 61 6e 64 6c 65 72 20 74 | 68 65 6e 20 63 61 6e 20 |andler t|hen can |
|000022f0| 75 73 65 20 74 68 61 74 | 20 6d 65 73 73 61 67 65 |use that| message|
|00002300| 3a 0d 0d 20 20 45 78 63 | 65 70 74 69 6f 6e 20 65 |:.. Exc|eption e|
|00002310| 78 63 20 61 73 20 4d 79 | 53 70 65 63 69 61 6c 45 |xc as My|SpecialE|
|00002320| 78 63 65 70 74 69 6f 6e | 0d 20 20 20 20 49 46 20 |xception|. IF |
|00002330| 65 78 63 2e 6d 73 67 20 | 3d 20 22 22 20 54 48 45 |exc.msg |= "" THE|
|00002340| 4e 0d 20 20 20 20 20 20 | 4d 73 67 42 6f 78 20 22 |N. |MsgBox "|
|00002350| 6f 6f 70 73 20 2d 20 41 | 64 64 4c 69 6e 65 54 6f |oops - A|ddLineTo|
|00002360| 54 65 78 74 66 69 6c 65 | 20 66 61 69 6c 65 64 20 |Textfile| failed |
|00002370| 66 6f 72 20 75 6e 6b 6e | 6f 77 6e 20 72 65 61 73 |for unkn|own reas|
|00002380| 6f 6e 2e 22 0d 20 20 20 | 20 45 4c 53 45 0d 20 20 |on.". | ELSE. |
|00002390| 20 20 20 20 4d 73 67 42 | 6f 78 20 22 6f 6f 70 73 | MsgB|ox "oops|
|000023a0| 20 2d 20 41 64 64 4c 69 | 6e 65 54 6f 54 65 78 74 | - AddLi|neToText|
|000023b0| 66 69 6c 65 20 66 61 69 | 6c 65 64 3a 20 22 20 2b |file fai|led: " +|
|000023c0| 20 65 78 63 2e 6d 73 67 | 0d 20 20 20 20 45 4e 44 | exc.msg|. END|
|000023d0| 0d 20 20 45 6e 64 20 53 | 75 62 0d 0d 0d 4d 61 6b |. End S|ub...Mak|
|000023e0| 69 6e 67 20 79 6f 75 72 | 20 6f 77 6e 20 73 75 62 |ing your| own sub|
|000023f0| 72 6f 75 74 69 6e 65 73 | 20 73 61 66 65 72 0d 2d |routines| safer.-|
|00002400| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002410| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002420| 0d 0d 54 68 65 72 65 27 | 73 20 61 6e 6f 74 68 65 |..There'|s anothe|
|00002430| 72 20 70 72 6f 62 6c 65 | 6d 20 79 6f 75 20 63 61 |r proble|m you ca|
|00002440| 6e 20 68 61 6e 64 6c 65 | 20 6e 69 63 65 6c 79 20 |n handle| nicely |
|00002450| 77 69 74 68 20 61 6e 0d | 65 78 63 65 70 74 69 6f |with an.|exceptio|
|00002460| 6e 20 68 61 6e 64 6c 65 | 72 3a 20 49 6e 20 61 20 |n handle|r: In a |
|00002470| 73 75 62 72 6f 75 74 69 | 6e 65 20 6f 66 20 79 6f |subrouti|ne of yo|
|00002480| 75 72 73 2c 20 74 68 65 | 72 65 0d 63 61 6e 20 62 |urs, the|re.can b|
|00002490| 65 20 6d 61 6e 79 20 65 | 72 72 6f 72 20 63 6f 6e |e many e|rror con|
|000024a0| 64 69 74 69 6f 6e 73 20 | 74 68 61 74 20 79 6f 75 |ditions |that you|
|000024b0| 20 61 72 65 6e 27 74 20 | 65 76 65 6e 0d 61 77 61 | aren't |even.awa|
|000024c0| 72 65 20 6f 66 20 61 6e | 64 20 74 68 75 73 20 63 |re of an|d thus c|
|000024d0| 61 6e 6e 6f 74 20 65 78 | 70 6c 69 63 69 74 6c 79 |annot ex|plicitly|
|000024e0| 20 68 61 6e 64 6c 65 20 | 61 6e 64 20 70 72 65 76 | handle |and prev|
|000024f0| 65 6e 74 0d 74 68 65 6d | 20 74 68 65 72 65 2e 0d |ent.them| there..|
|00002500| 0d 48 6f 77 65 76 65 72 | 2c 20 77 68 61 74 20 79 |.However|, what y|
|00002510| 6f 75 20 63 61 6e 20 61 | 74 20 6c 65 61 73 74 20 |ou can a|t least |
|00002520| 64 6f 20 69 73 20 74 6f | 20 74 61 6b 65 20 63 61 |do is to| take ca|
|00002530| 72 65 0d 6f 66 20 74 68 | 6f 73 65 20 65 78 63 65 |re.of th|ose exce|
|00002540| 70 74 69 6f 6e 61 6c 20 | 63 61 73 65 73 20 61 6e |ptional |cases an|
|00002550| 64 20 64 6f 20 61 20 22 | 63 6c 65 61 6e 75 70 22 |d do a "|cleanup"|
|00002560| 20 6f 66 0d 74 68 65 20 | 64 61 74 61 20 79 6f 75 | of.the |data you|
|00002570| 20 61 66 66 65 63 74 65 | 64 20 69 6e 20 74 68 61 | affecte|d in tha|
|00002580| 74 20 73 75 62 72 6f 75 | 74 69 6e 65 2e 0d 0d 46 |t subrou|tine...F|
|00002590| 6f 72 20 69 6e 73 74 61 | 6e 63 65 2c 20 69 66 20 |or insta|nce, if |
|000025a0| 79 6f 75 20 6f 70 65 6e | 20 61 6e 64 20 77 72 69 |you open| and wri|
|000025b0| 74 65 20 74 6f 20 61 20 | 66 69 6c 65 0d 69 6e 20 |te to a |file.in |
|000025c0| 61 20 73 75 62 72 6f 75 | 74 69 6e 65 2c 20 61 6e |a subrou|tine, an|
|000025d0| 64 20 74 68 65 6e 20 73 | 6f 6d 65 20 75 6e 70 72 |d then s|ome unpr|
|000025e0| 65 64 69 63 74 61 62 6c | 65 20 65 72 72 6f 72 2c |edictabl|e error,|
|000025f0| 0d 6c 69 6b 65 20 61 20 | 73 74 61 63 6b 20 6f 76 |.like a |stack ov|
|00002600| 65 72 66 6c 6f 77 2c 20 | 68 61 70 70 65 6e 73 20 |erflow, |happens |
|00002610| 69 6e 20 74 68 65 72 65 | 2c 0d 79 6f 75 20 73 68 |in there|,.you sh|
|00002620| 6f 75 6c 64 20 61 74 20 | 6c 65 61 73 74 20 6d 61 |ould at |least ma|
|00002630| 6b 65 20 73 75 72 65 20 | 74 68 61 74 20 79 6f 75 |ke sure |that you|
|00002640| 20 63 6c 6f 73 65 20 74 | 68 65 0d 66 69 6c 65 20 | close t|he.file |
|00002650| 62 65 66 6f 72 65 20 79 | 6f 75 20 6c 6f 73 65 20 |before y|ou lose |
|00002660| 69 74 73 20 72 65 66 65 | 72 65 6e 63 65 2e 0d 0d |its refe|rence...|
|00002670| 48 65 72 65 27 73 20 61 | 6e 20 65 78 61 6d 70 6c |Here's a|n exampl|
|00002680| 65 3a 0d 0d 20 20 53 75 | 62 20 41 70 70 65 6e 64 |e:.. Su|b Append|
|00002690| 53 6f 6d 65 44 61 74 61 | 54 6f 46 69 6c 65 20 28 |SomeData|ToFile (|
|000026a0| 66 69 6c 65 52 65 66 20 | 61 73 20 46 6f 6c 64 65 |fileRef |as Folde|
|000026b0| 72 49 74 65 6d 29 0d 20 | 20 20 20 44 69 6d 20 66 |rItem). | Dim f|
|000026c0| 69 6c 65 53 74 72 65 61 | 6d 20 41 73 20 54 65 78 |ileStrea|m As Tex|
|000026d0| 74 4f 75 74 70 75 74 53 | 74 72 65 61 6d 0d 20 20 |tOutputS|tream. |
|000026e0| 20 20 44 69 6d 20 6e 65 | 65 64 73 43 6c 6f 73 65 | Dim ne|edsClose|
|000026f0| 20 61 73 20 42 6f 6f 6c | 65 61 6e 0d 20 20 20 20 | as Bool|ean. |
|00002700| 66 69 6c 65 53 74 72 65 | 61 6d 20 3d 20 66 69 6c |fileStre|am = fil|
|00002710| 65 52 65 66 2e 41 70 70 | 65 6e 64 54 6f 54 65 78 |eRef.App|endToTex|
|00002720| 74 46 69 6c 65 0d 20 20 | 20 20 6e 65 65 64 73 43 |tFile. | needsC|
|00002730| 6c 6f 73 65 20 3d 20 74 | 72 75 65 0d 20 20 20 20 |lose = t|rue. |
|00002740| 66 69 6c 65 53 74 72 65 | 61 6d 2e 57 72 69 74 65 |fileStre|am.Write|
|00002750| 4c 69 6e 65 20 28 22 6a | 75 73 74 20 73 6f 6d 65 |Line ("j|ust some|
|00002760| 20 64 61 74 61 22 29 0d | 20 20 20 20 6e 65 65 64 | data").| need|
|00002770| 73 43 6c 6f 73 65 20 3d | 20 66 61 6c 73 65 0d 20 |sClose =| false. |
|00002780| 20 20 20 66 69 6c 65 53 | 74 72 65 61 6d 2e 43 6c | fileS|tream.Cl|
|00002790| 6f 73 65 0d 20 20 45 78 | 63 65 70 74 69 6f 6e 20 |ose. Ex|ception |
|000027a0| 65 78 63 20 61 73 20 52 | 75 6e 74 69 6d 65 45 78 |exc as R|untimeEx|
|000027b0| 63 65 70 74 69 6f 6e 0d | 20 20 20 20 27 20 63 6c |ception.| ' cl|
|000027c0| 65 61 6e 20 75 70 20 69 | 6e 20 63 61 73 65 20 6f |ean up i|n case o|
|000027d0| 66 20 61 6e 79 20 65 72 | 72 6f 72 20 2d 20 69 6e |f any er|ror - in|
|000027e0| 20 74 68 69 73 20 63 61 | 73 65 2c 20 63 6c 6f 73 | this ca|se, clos|
|000027f0| 65 20 74 68 65 20 66 69 | 6c 65 20 69 66 20 69 74 |e the fi|le if it|
|00002800| 20 69 73 20 73 74 69 6c | 6c 20 6f 70 65 6e 0d 20 | is stil|l open. |
|00002810| 20 20 20 49 46 20 6e 65 | 65 64 73 43 6c 6f 73 65 | IF ne|edsClose|
|00002820| 20 54 48 45 4e 0d 20 20 | 20 20 20 20 66 69 6c 65 | THEN. | file|
|00002830| 53 74 72 65 61 6d 2e 43 | 6c 6f 73 65 0d 20 20 20 |Stream.C|lose. |
|00002840| 20 45 4e 44 0d 20 20 20 | 20 27 20 6e 6f 77 20 70 | END. | ' now p|
|00002850| 61 73 73 20 6f 6e 20 74 | 68 65 20 65 78 63 65 70 |ass on t|he excep|
|00002860| 74 69 6f 6e 20 62 65 63 | 61 75 73 65 20 77 65 27 |tion bec|ause we'|
|00002870| 72 65 20 6e 6f 74 20 61 | 62 6c 65 20 74 6f 20 68 |re not a|ble to h|
|00002880| 61 6e 64 6c 65 20 69 74 | 20 68 65 72 65 0d 20 20 |andle it| here. |
|00002890| 20 20 52 61 69 73 65 20 | 65 78 63 0d 20 20 45 6e | Raise |exc. En|
|000028a0| 64 20 53 75 62 0d 0d 0d | 4d 6f 72 65 20 69 64 65 |d Sub...|More ide|
|000028b0| 61 73 20 66 6f 72 20 61 | 6e 20 65 66 66 65 63 74 |as for a|n effect|
|000028c0| 69 76 65 20 65 78 63 65 | 70 74 69 6f 6e 20 68 61 |ive exce|ption ha|
|000028d0| 6e 64 6c 69 6e 67 0d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |ndling.-|--------|
|000028e0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000028f0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00002900| 2d 2d 2d 2d 2d 0d 0d 54 | 68 65 73 65 20 77 65 72 |-----..T|hese wer|
|00002910| 65 20 74 68 65 20 62 61 | 73 69 63 73 20 66 6f 72 |e the ba|sics for|
|00002920| 20 68 61 6e 64 6c 69 6e | 67 20 65 78 63 65 70 74 | handlin|g except|
|00002930| 69 6f 6e 73 20 69 6e 20 | 79 6f 75 72 20 63 6f 64 |ions in |your cod|
|00002940| 65 2e 0d 0d 48 65 72 65 | 27 73 20 73 6f 6d 65 20 |e...Here|'s some |
|00002950| 6d 6f 72 65 20 74 69 70 | 73 3a 0d 0d 2a 20 57 69 |more tip|s:..* Wi|
|00002960| 74 68 20 52 42 20 76 65 | 72 73 69 6f 6e 20 32 20 |th RB ve|rsion 2 |
|00002970| 28 63 75 72 72 65 6e 74 | 6c 79 20 75 6e 64 65 72 |(current|ly under|
|00002980| 20 64 65 76 65 6c 6f 70 | 6d 65 6e 74 29 20 79 6f | develop|ment) yo|
|00002990| 75 20 63 61 6e 0d 20 20 | 70 61 73 73 20 61 72 67 |u can. |pass arg|
|000029a0| 75 6d 65 6e 74 73 20 74 | 6f 20 79 6f 75 72 20 65 |uments t|o your e|
|000029b0| 78 63 65 70 74 69 6f 6e | 73 20 68 61 6e 64 6c 65 |xception|s handle|
|000029c0| 72 73 20 6d 6f 72 65 20 | 65 61 73 69 6c 79 0d 20 |rs more |easily. |
|000029d0| 20 62 79 20 75 73 69 6e | 67 20 61 20 73 6f 2d 63 | by usin|g a so-c|
|000029e0| 61 6c 6c 65 64 20 63 6f | 6e 73 74 72 75 63 74 6f |alled co|nstructo|
|000029f0| 72 3a 0d 20 20 49 6e 20 | 74 68 65 20 4d 79 53 70 |r:. In |the MySp|
|00002a00| 65 63 69 61 6c 45 78 63 | 65 70 74 69 6f 6e 20 61 |ecialExc|eption a|
|00002a10| 64 64 20 74 68 69 73 20 | 6d 65 74 68 6f 64 3a 0d |dd this |method:.|
|00002a20| 0d 20 20 20 20 53 75 62 | 20 4d 79 53 70 65 63 69 |. Sub| MySpeci|
|00002a30| 61 6c 45 78 63 65 70 74 | 69 6f 6e 28 22 6d 73 67 |alExcept|ion("msg|
|00002a40| 20 61 73 20 53 74 72 69 | 6e 67 22 29 0d 20 20 20 | as Stri|ng"). |
|00002a50| 20 20 20 73 65 6c 66 2e | 6d 73 67 20 3d 20 6d 73 | self.|msg = ms|
|00002a60| 67 0d 20 20 20 20 45 6e | 64 20 53 75 62 0d 0d 20 |g. En|d Sub.. |
|00002a70| 20 54 68 65 6e 20 79 6f | 75 20 63 61 6e 20 72 61 | Then yo|u can ra|
|00002a80| 69 73 65 20 65 78 63 65 | 70 74 69 6f 6e 73 20 77 |ise exce|ptions w|
|00002a90| 69 74 68 20 6d 65 73 73 | 61 67 65 73 20 65 61 73 |ith mess|ages eas|
|00002aa0| 69 65 72 0d 20 20 75 73 | 69 6e 67 20 74 68 69 73 |ier. us|ing this|
|00002ab0| 20 73 69 6e 67 6c 65 20 | 6c 69 6e 65 3a 0d 0d 20 | single |line:.. |
|00002ac0| 20 20 20 52 61 69 73 65 | 20 6e 65 77 20 4d 79 53 | Raise| new MyS|
|00002ad0| 70 65 63 69 61 6c 45 78 | 63 65 70 74 69 6f 6e 20 |pecialEx|ception |
|00002ae0| 28 22 68 65 72 65 20 63 | 6f 6d 65 73 20 74 68 65 |("here c|omes the|
|00002af0| 20 6d 65 73 73 61 67 65 | 22 29 0d 0d 2a 20 41 6c | message|")..* Al|
|00002b00| 73 6f 20 61 76 61 69 6c | 61 62 6c 65 20 69 6e 20 |so avail|able in |
|00002b10| 52 42 20 76 65 72 73 69 | 6f 6e 20 32 20 69 73 20 |RB versi|on 2 is |
|00002b20| 61 20 6e 65 77 20 75 6e | 69 76 65 72 73 61 6c 20 |a new un|iversal |
|00002b30| 74 79 70 65 2c 0d 20 20 | 63 61 6c 6c 65 64 20 61 |type,. |called a|
|00002b40| 20 56 61 72 69 61 6e 74 | 2e 20 55 73 69 6e 67 20 | Variant|. Using |
|00002b50| 74 68 61 74 2c 20 79 6f | 75 20 63 61 6e 20 6d 61 |that, yo|u can ma|
|00002b60| 6b 65 20 74 68 65 20 6d | 65 73 73 61 67 69 6e 67 |ke the m|essaging|
|00002b70| 0d 20 20 6d 6f 72 65 20 | 76 65 72 73 61 74 69 6c |. more |versatil|
|00002b80| 65 20 62 79 20 63 68 61 | 6e 67 69 6e 67 20 69 74 |e by cha|nging it|
|00002b90| 73 20 74 79 70 65 20 66 | 72 6f 6d 20 53 74 72 69 |s type f|rom Stri|
|00002ba0| 6e 67 20 74 6f 20 56 61 | 72 69 61 6e 74 2e 0d 20 |ng to Va|riant.. |
|00002bb0| 20 54 68 65 6e 20 79 6f | 75 20 63 61 6e 20 70 61 | Then yo|u can pa|
|00002bc0| 73 73 20 61 6e 79 20 62 | 61 73 69 63 20 74 79 70 |ss any b|asic typ|
|00002bd0| 65 20 74 6f 20 69 74 2c | 20 6c 69 6b 65 20 53 74 |e to it,| like St|
|00002be0| 72 69 6e 67 73 2c 20 49 | 6e 74 65 67 65 72 73 2c |rings, I|ntegers,|
|00002bf0| 0d 20 20 42 6f 6f 6c 65 | 61 6e 73 20 65 74 63 2e |. Boole|ans etc.|
|00002c00| 0d 0d 54 68 61 74 27 73 | 20 69 74 20 66 6f 72 20 |..That's| it for |
|00002c10| 6e 6f 77 2e 20 50 6c 65 | 61 73 65 20 6c 65 74 20 |now. Ple|ase let |
|00002c20| 6d 65 20 6b 6e 6f 77 20 | 69 66 20 79 6f 75 20 68 |me know |if you h|
|00002c30| 61 76 65 20 61 64 64 69 | 74 69 6f 6e 73 2c 0d 63 |ave addi|tions,.c|
|00002c40| 6f 72 72 65 63 74 69 6f | 6e 73 20 6f 72 20 71 75 |orrectio|ns or qu|
|00002c50| 65 73 74 69 6f 6e 73 20 | 74 6f 20 74 68 69 73 20 |estions |to this |
|00002c60| 74 65 78 74 2e 20 57 72 | 69 74 65 20 74 6f 3a 20 |text. Wr|ite to: |
|00002c70| 72 62 40 74 65 6d 70 65 | 6c 2e 6f 72 67 0d 0d 57 |rb@tempe|l.org..W|
|00002c80| 72 69 74 74 65 6e 20 61 | 6e 64 20 63 6f 70 79 72 |ritten a|nd copyr|
|00002c90| 69 67 68 74 65 64 20 62 | 79 0d 20 20 54 68 6f 6d |ighted b|y. Thom|
|00002ca0| 61 73 20 54 65 6d 70 65 | 6c 6d 61 6e 6e 2c 20 4d |as Tempe|lmann, M|
|00002cb0| 61 72 63 68 20 31 34 2c | 20 39 39 0d 00 00 00 16 |arch 14,| 99.....|
|00002cc0| 00 01 00 00 00 00 00 0b | 00 09 00 04 00 00 00 09 |........|........|
|00002cd0| 00 00 00 00 00 00 00 00 | 00 30 00 00 00 01 00 00 |........|.0......|
|00002ce0| 00 04 00 00 00 00 00 00 | 00 02 54 45 58 54 00 00 |........|..TEXT..|
|00002cf0| 01 00 00 00 00 00 00 00 | 00 00 73 74 79 6c 00 00 |........|..styl..|
|00002d00| 01 00 00 00 00 00 00 00 | 00 00 00 00 00 24 00 00 |........|.....$..|
|00002d10| 00 05 00 01 04 07 00 3c | 00 53 02 9c 02 3c 00 00 |.......<|.S...<..|
|00002d20| 00 00 00 00 01 70 8c 00 | 00 00 09 99 91 e0 00 00 |.....p..|........|
|00002d30| 00 00 00 00 01 00 00 00 | 2c b2 00 00 2b b2 00 00 |........|,...+...|
|00002d40| 00 6e 09 75 f7 00 33 6a | 00 00 00 1c 00 6e 00 03 |.n.u..3j|.....n..|
|00002d50| 54 45 58 54 00 00 00 22 | 73 74 79 6c 00 00 00 2e |TEXT..."|styl....|
|00002d60| 64 72 61 67 00 00 00 3a | 6b 77 73 74 00 00 00 46 |drag...:|kwst...F|
|00002d70| 01 00 ff ff 00 00 00 00 | 00 00 00 00 01 00 ff ff |........|........|
|00002d80| 00 00 2b 3c 00 00 00 00 | 00 80 ff ff 00 00 2b 56 |..+<....|......+V|
|00002d90| 00 00 00 00 bf 4c ff ff | 00 00 2b 8a 00 e2 67 18 |.....L..|..+...g.|
|00002da0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002db0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dc0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002dd0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002de0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00002df0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+